package leetcom.com234;

import java.util.HashSet;
import java.util.Set;
//5713
public class Ex5713 {
    public int numDifferentIntegers(String word) {
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < word.length(); i++) {
            int num = 0;
            if(i < word.length()&&Character.isDigit(word.charAt(i))) {
                while (i < word.length() && Character.isDigit(word.charAt(i))) {
                    num = num * 10 + word.charAt(i) - '0';
                    i++;
                }
                i--;
                set.add(num);
            }
        }
        int res = 0;
        for (Integer integer : set) {
            res++;
        }
        return res;
    }
}
